package v1

import (
	"github.com/gogf/gf/v2/frame/g"
)

type RoleListReq struct {
	g.Meta `path:"/role/list" method:"get" summary:"获取角色列表"`
	Page   int    `p:"page" d:"1"`
	Limit  int    `p:"limit" d:"10"`
	Search string `p:"search"`
	Sort   string `p:"sort"`
}

type RoleListRes struct {
	List  []*Role `json:"items"`
	Total int     `json:"total"`
}

type CreateRoleReq struct {
	g.Meta `path:"/role/create" method:"post" summary:"创建角色"`
	Role
}

type CreateRoleRes struct{}

type Role struct {
	Id     int         `json:"id"`
	Code   string      `json:"code" v:"required" `
	Name   string      `json:"name" v:"required" `
	Remark string      `json:"remark"`
	Sort   int         `json:"sort"`
	Status int         `json:"status" v:"required"`
	Routes interface{} `json:"routes"`
}

type DeleteRoleReq struct {
	g.Meta `path:"/role/{id}" method:"delete" summary:"删除角色"`
}

type DeleteRoleRes struct{}

type UpdateRoleReq struct {
	g.Meta `path:"/role/update" method:"put" summary:"更新角色"`
	Role
}

type UpdateRoleRes struct{}

type AllRolesReq struct {
	g.Meta `path:"/role/all" method:"get" summary:"获取所有角色"`
}

type AllRolesRes struct {
	List []*RoleOption `json:"list"`
}

type RoleOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}
